#include<iostream>
#include<algorithm>
using namespace std;
const int N = 3e4 + 10;
int k;
int n;
int cnt;
int arr[N];
bool st[N];
int main()
{
	cin >> k >> n;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	sort(arr, arr + n);
	/*for (int i = 0; i < n; i++) {
		cout << arr[i] << " ";
	}
	cout << "------------------" << endl;*/
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j > i; j--) {
			if (arr[i] + arr[j] <= k && !st[i]&&!st[j]) {
				cnt++;
				//cout << arr[i] << " " << arr[j] << endl;
				st[i] = 1;
				st[j] = 1;
			}
		}
	}
	for (int i = 0; i < n; i++) {
		if (!st[i]) {
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}